#!/bin/bash
# 等待mysql容器启动
while ! nc -z db 3306 ; do
    echo "Waiting for the MySQL Server"
    sleep 3
done

# 收集静态文件
python manage.py collectstatic --noinput&&

# django的数据库迁移
python manage.py makemigrations&&
python manage.py migrate&&

# uwsgi启动项目
uwsgi --ini /var/www/html/netshop/uwsgi.ini&&

# 这里是为了保持容器状态
tail -f /dev/null

echo "Your Django application is now running!"
exec "$@"